<template>
	<div class="app-container2">
		<el-form ref="form" :model="ruleForm" label-width="80px" :inline="true">
			<el-form-item label="所属站点:">
				<el-cascader
					v-model="value1"
					:options="options"
					@change="handleChange"
				></el-cascader>
			</el-form-item>
		</el-form>
		<div
			style="
				margin-bottom: 24px;
				display: flex;
				justify-content: space-between;
			"
		>
			<div style="display: flex; align-items: center">
				<el-button
					type="danger"
					icon="el-icon-plus"
					style="margin-right: 12px"
					@click="add"
					>新增</el-button
				>
				<el-card>
					<i
						class="el-icon-info"
						style="font-size: 18px; color: #faad14; margin: 0 8px"
					></i>
					<span style="font-size: 14px; color: #ff4d4f"
						>还可以添加8个展示栏目，最多可显示16个</span
					>
				</el-card>
			</div>
			<div style="display: flex; align-items: center">
				<el-button @click="submit">重置</el-button>
				<el-button type="danger">查询</el-button>
			</div>
		</div>
		<el-table :data="list" style="width: 100%" v-loading="loading">
			<el-table-column prop="date" label="栏目名称" align="center">
			</el-table-column>
			<el-table-column prop="date" label="导航栏显示" align="center">
			</el-table-column>
			<el-table-column prop="date" label="排序" align="center">
			</el-table-column>
			<el-table-column label="操作" align="center">
				<template slot-scope="{ row }">
					<div
						style="
							display: flex;
							align-items: center;
							justify-content: center;
						"
					>
						<!-- <el-button type="text">添加下级栏目</el-button> -->
						<el-button type="text" @click="edit(row)"
							>编辑</el-button
						>
						<el-button type="text" @click="del(row)"
							>删除</el-button
						>
					</div>
				</template>
			</el-table-column>
		</el-table>
		<pagination
			v-show="ruleForm.total > 0"
			:total="ruleForm.total"
			:page.sync="ruleForm.pageNum"
			:limit.sync="ruleForm.pageSize"
			@pagination="() => {}"
		/>
		<el-dialog
			:title="form.id ? '编辑栏目' : '新增栏目'"
			:visible.sync="dialogVisible"
			width="500px"
		>
			<el-form
				:model="ruleForm"
				:rules="rules"
				ref="ruleForm"
				label-width="100px"
				class="demo-ruleForm"
			>
				<el-form-item label="父级栏目">
					<el-input v-model="form.name" disabled></el-input>
				</el-form-item>
				<el-form-item label="排序" prop="name">
					<el-input-number
						controls-position="right"
						v-model="form.name"
						style="width: 100%"
					></el-input-number>
				</el-form-item>
				<el-form-item label="栏目" prop="name">
					<el-input
						v-model="form.name"
						placeholder="请输入栏目名称"
					></el-input>
				</el-form-item>
				<el-form-item label="" prop="name">
					<el-checkbox>显示(只用于党委首页的头部导航)</el-checkbox>
				</el-form-item>
				<el-form-item label="备注" prop="name">
					<el-input type="textarea" v-model="form.name"></el-input>
				</el-form-item>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible = false">取 消</el-button>
				<el-button type="primary" @click="dialogVisible = false"
					>确 定</el-button
				>
			</span>
		</el-dialog>
	</div>
</template>

<script>
// import { } from "@/api/card/home";
export default {
	data() {
		return {
			loading: false,
			value1: '',
			dialogVisible: false,
			list: [{}],
			ruleForm: {
				pageNum: 1,
				pageSize: 10,
				total: 0,
				type: [],
			},
			rules: {
				name: [
					{
						required: true,
						message: '请输入活动名称',
						trigger: 'blur',
					},
				],
			},
			options: [],
			form: {},
		}
	},
	methods: {
		submit() {
			
		},
		handleChange() {},
		//切换分页
		handleCurrentChange(val) {
			this.loading = true
			this.ruleForm.pageNum = val
		},
		//切换总条数
		handleSizeChange(val) {
			this.loading = true
			this.ruleForm.pageSize = val
		},
		add() {
			this.dialogVisible = true
		},
		edit(row) {
			this.form = Object.assign({}, row)
			this.dialogVisible = true
		},
		del(row) {
			this.$confirm(
				`删除后，栏目下的文章也将无法展示！`,
				'您确定要删除该栏目吗?',
				{
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning',
				}
			)
				.then(() => {})
				.catch(() => {})
		},
	},
	created() {},
}
</script>

<style lang="scss" scoped>
::v-deep .el-card__body {
	padding: 6px 12px;
}
</style>
